using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.Net;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml;

namespace Microsoft.SqlServer.Tools.HostingServices
{
	[GeneratedCode("wsdl", "2.0.50727.42"), DesignerCategory("code"), DebuggerStepThrough, WebServiceBinding(Name = "PublishServiceSoap", Namespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing")]
	public class PublishService : SoapHttpClientProtocol
	{
		private SendOrPostCallback BeginPublishOperationCompleted;

		private SendOrPostCallback PublishScriptOperationCompleted;

		private SendOrPostCallback PublishDataOperationCompleted;

		private SendOrPostCallback EndPublishOperationCompleted;

		private SendOrPostCallback CancelPublishOperationCompleted;

		private SendOrPostCallback GetServiceOptionsOperationCompleted;

        public event BeginPublishCompletedEventHandler BeginPublishCompleted;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.BeginPublishCompleted = (BeginPublishCompletedEventHandler)Delegate.Combine(this.BeginPublishCompleted, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.BeginPublishCompleted = (BeginPublishCompletedEventHandler)Delegate.Remove(this.BeginPublishCompleted, value);
        //    }
        //}

        public event PublishScriptCompletedEventHandler PublishScriptCompleted;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.PublishScriptCompleted = (PublishScriptCompletedEventHandler)Delegate.Combine(this.PublishScriptCompleted, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.PublishScriptCompleted = (PublishScriptCompletedEventHandler)Delegate.Remove(this.PublishScriptCompleted, value);
        //    }
        //}

        public event PublishDataCompletedEventHandler PublishDataCompleted;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.PublishDataCompleted = (PublishDataCompletedEventHandler)Delegate.Combine(this.PublishDataCompleted, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.PublishDataCompleted = (PublishDataCompletedEventHandler)Delegate.Remove(this.PublishDataCompleted, value);
        //    }
        //}

        public event EndPublishCompletedEventHandler EndPublishCompleted;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.EndPublishCompleted = (EndPublishCompletedEventHandler)Delegate.Combine(this.EndPublishCompleted, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.EndPublishCompleted = (EndPublishCompletedEventHandler)Delegate.Remove(this.EndPublishCompleted, value);
        //    }
        //}

        public event CancelPublishCompletedEventHandler CancelPublishCompleted;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.CancelPublishCompleted = (CancelPublishCompletedEventHandler)Delegate.Combine(this.CancelPublishCompleted, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.CancelPublishCompleted = (CancelPublishCompletedEventHandler)Delegate.Remove(this.CancelPublishCompleted, value);
        //    }
        //}

        public event GetServiceOptionsCompletedEventHandler GetServiceOptionsCompleted;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.GetServiceOptionsCompleted = (GetServiceOptionsCompletedEventHandler)Delegate.Combine(this.GetServiceOptionsCompleted, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.GetServiceOptionsCompleted = (GetServiceOptionsCompletedEventHandler)Delegate.Remove(this.GetServiceOptionsCompleted, value);
        //    }
        //}

		public PublishService()
		{
			base.Url = "http://localhost/test/Publish/Service.asmx";
		}

		[SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/2006/12/publishing/BeginPublish", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public void BeginPublish(string serverName, string databaseName, string sqlUsername, string sqlPassword, bool useTransactions)
		{
			base.Invoke("BeginPublish", new object[]
			{
				serverName,
				databaseName,
				sqlUsername,
				sqlPassword,
				useTransactions
			});
		}

		public IAsyncResult BeginBeginPublish(string serverName, string databaseName, string sqlUsername, string sqlPassword, bool useTransactions, AsyncCallback callback, object asyncState)
		{
			return base.BeginInvoke("BeginPublish", new object[]
			{
				serverName,
				databaseName,
				sqlUsername,
				sqlPassword,
				useTransactions
			}, callback, asyncState);
		}

		public void EndBeginPublish(IAsyncResult asyncResult)
		{
			base.EndInvoke(asyncResult);
		}

		public void BeginPublishAsync(string serverName, string databaseName, string sqlUsername, string sqlPassword, bool useTransactions)
		{
			this.BeginPublishAsync(serverName, databaseName, sqlUsername, sqlPassword, useTransactions, null);
		}

		public void BeginPublishAsync(string serverName, string databaseName, string sqlUsername, string sqlPassword, bool useTransactions, object userState)
		{
			if (this.BeginPublishOperationCompleted == null)
			{
				this.BeginPublishOperationCompleted = new SendOrPostCallback(this.OnBeginPublishOperationCompleted);
			}
			base.InvokeAsync("BeginPublish", new object[]
			{
				serverName,
				databaseName,
				sqlUsername,
				sqlPassword,
				useTransactions
			}, this.BeginPublishOperationCompleted, userState);
		}

		private void OnBeginPublishOperationCompleted(object arg)
		{
			if (this.BeginPublishCompleted != null)
			{
				InvokeCompletedEventArgs invokeCompletedEventArgs = (InvokeCompletedEventArgs)arg;
				this.BeginPublishCompleted(this, new AsyncCompletedEventArgs(invokeCompletedEventArgs.Error, invokeCompletedEventArgs.Cancelled, invokeCompletedEventArgs.UserState));
			}
		}

		[SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/2006/12/publishing/PublishScript", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public void PublishScript(string script)
		{
			base.Invoke("PublishScript", new object[]
			{
				script
			});
		}

		public IAsyncResult BeginPublishScript(string script, AsyncCallback callback, object asyncState)
		{
			return base.BeginInvoke("PublishScript", new object[]
			{
				script
			}, callback, asyncState);
		}

		public void EndPublishScript(IAsyncResult asyncResult)
		{
			base.EndInvoke(asyncResult);
		}

		public void PublishScriptAsync(string script)
		{
			this.PublishScriptAsync(script, null);
		}

		public void PublishScriptAsync(string script, object userState)
		{
			if (this.PublishScriptOperationCompleted == null)
			{
				this.PublishScriptOperationCompleted = new SendOrPostCallback(this.OnPublishScriptOperationCompleted);
			}
			base.InvokeAsync("PublishScript", new object[]
			{
				script
			}, this.PublishScriptOperationCompleted, userState);
		}

		private void OnPublishScriptOperationCompleted(object arg)
		{
			if (this.PublishScriptCompleted != null)
			{
				InvokeCompletedEventArgs invokeCompletedEventArgs = (InvokeCompletedEventArgs)arg;
				this.PublishScriptCompleted(this, new AsyncCompletedEventArgs(invokeCompletedEventArgs.Error, invokeCompletedEventArgs.Cancelled, invokeCompletedEventArgs.UserState));
			}
		}

		[SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/2006/12/publishing/PublishData", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public void PublishData(DataSet ds)
		{
			base.Invoke("PublishData", new object[]
			{
				ds
			});
		}

		public IAsyncResult BeginPublishData(DataSet ds, AsyncCallback callback, object asyncState)
		{
			return base.BeginInvoke("PublishData", new object[]
			{
				ds
			}, callback, asyncState);
		}

		public void EndPublishData(IAsyncResult asyncResult)
		{
			base.EndInvoke(asyncResult);
		}

		public void PublishDataAsync(DataSet ds)
		{
			this.PublishDataAsync(ds, null);
		}

		public void PublishDataAsync(DataSet ds, object userState)
		{
			if (this.PublishDataOperationCompleted == null)
			{
				this.PublishDataOperationCompleted = new SendOrPostCallback(this.OnPublishDataOperationCompleted);
			}
			base.InvokeAsync("PublishData", new object[]
			{
				ds
			}, this.PublishDataOperationCompleted, userState);
		}

		private void OnPublishDataOperationCompleted(object arg)
		{
			if (this.PublishDataCompleted != null)
			{
				InvokeCompletedEventArgs invokeCompletedEventArgs = (InvokeCompletedEventArgs)arg;
				this.PublishDataCompleted(this, new AsyncCompletedEventArgs(invokeCompletedEventArgs.Error, invokeCompletedEventArgs.Cancelled, invokeCompletedEventArgs.UserState));
			}
		}

		[SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/2006/12/publishing/EndPublish", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public void EndPublish()
		{
			base.Invoke("EndPublish", new object[0]);
		}

		public IAsyncResult BeginEndPublish(AsyncCallback callback, object asyncState)
		{
			return base.BeginInvoke("EndPublish", new object[0], callback, asyncState);
		}

		public void EndEndPublish(IAsyncResult asyncResult)
		{
			base.EndInvoke(asyncResult);
		}

		public void EndPublishAsync()
		{
			this.EndPublishAsync(null);
		}

		public void EndPublishAsync(object userState)
		{
			if (this.EndPublishOperationCompleted == null)
			{
				this.EndPublishOperationCompleted = new SendOrPostCallback(this.OnEndPublishOperationCompleted);
			}
			base.InvokeAsync("EndPublish", new object[0], this.EndPublishOperationCompleted, userState);
		}

		private void OnEndPublishOperationCompleted(object arg)
		{
			if (this.EndPublishCompleted != null)
			{
				InvokeCompletedEventArgs invokeCompletedEventArgs = (InvokeCompletedEventArgs)arg;
				this.EndPublishCompleted(this, new AsyncCompletedEventArgs(invokeCompletedEventArgs.Error, invokeCompletedEventArgs.Cancelled, invokeCompletedEventArgs.UserState));
			}
		}

		[SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/2006/12/publishing/CancelPublish", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public void CancelPublish()
		{
			base.Invoke("CancelPublish", new object[0]);
		}

		public IAsyncResult BeginCancelPublish(AsyncCallback callback, object asyncState)
		{
			return base.BeginInvoke("CancelPublish", new object[0], callback, asyncState);
		}

		public void EndCancelPublish(IAsyncResult asyncResult)
		{
			base.EndInvoke(asyncResult);
		}

		public void CancelPublishAsync()
		{
			this.CancelPublishAsync(null);
		}

		public void CancelPublishAsync(object userState)
		{
			if (this.CancelPublishOperationCompleted == null)
			{
				this.CancelPublishOperationCompleted = new SendOrPostCallback(this.OnCancelPublishOperationCompleted);
			}
			base.InvokeAsync("CancelPublish", new object[0], this.CancelPublishOperationCompleted, userState);
		}

		private void OnCancelPublishOperationCompleted(object arg)
		{
			if (this.CancelPublishCompleted != null)
			{
				InvokeCompletedEventArgs invokeCompletedEventArgs = (InvokeCompletedEventArgs)arg;
				this.CancelPublishCompleted(this, new AsyncCompletedEventArgs(invokeCompletedEventArgs.Error, invokeCompletedEventArgs.Cancelled, invokeCompletedEventArgs.UserState));
			}
		}

		[SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/2006/12/publishing/GetServiceOptions", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2006/12/publishing", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
		public XmlDocument GetServiceOptions()
		{
			object[] array = base.Invoke("GetServiceOptions", new object[0]);
			return (XmlDocument)array[0];
		}

		public IAsyncResult BeginGetServiceOptions(AsyncCallback callback, object asyncState)
		{
			return base.BeginInvoke("GetServiceOptions", new object[0], callback, asyncState);
		}

		public XmlDocument EndGetServiceOptions(IAsyncResult asyncResult)
		{
			object[] array = base.EndInvoke(asyncResult);
			return (XmlDocument)array[0];
		}

		public void GetServiceOptionsAsync()
		{
			this.GetServiceOptionsAsync(null);
		}

		public void GetServiceOptionsAsync(object userState)
		{
			if (this.GetServiceOptionsOperationCompleted == null)
			{
				this.GetServiceOptionsOperationCompleted = new SendOrPostCallback(this.OnGetServiceOptionsOperationCompleted);
			}
			base.InvokeAsync("GetServiceOptions", new object[0], this.GetServiceOptionsOperationCompleted, userState);
		}

		private void OnGetServiceOptionsOperationCompleted(object arg)
		{
			if (this.GetServiceOptionsCompleted != null)
			{
				InvokeCompletedEventArgs invokeCompletedEventArgs = (InvokeCompletedEventArgs)arg;
				this.GetServiceOptionsCompleted(this, new GetServiceOptionsCompletedEventArgs(invokeCompletedEventArgs.Results, invokeCompletedEventArgs.Error, invokeCompletedEventArgs.Cancelled, invokeCompletedEventArgs.UserState));
			}
		}

		public new void CancelAsync(object userState)
		{
			base.CancelAsync(userState);
		}

		protected override WebRequest GetWebRequest(Uri uri)
		{
			WebRequest webRequest = base.GetWebRequest(uri);
			try
			{
				webRequest.Headers.Set("Accept-Language", CultureInfo.CurrentUICulture.ToString());
			}
			catch (Exception)
			{
			}
			return webRequest;
		}
	}
}
